#!/bin/sh
#
# rc Script for vsftpd.
# (c) dangbinghoo@gmail.com.
#     playpenguin.org
#

cmd_bin="/usr/sbin/vsftpd"
cmd_param="/etc/vsftpd.conf"

. /etc/init.d/rcfunctions

start()
{	
	rc_do_msg "Starting vsftpd "
	start_daemon "${cmd_bin}" "${cmd_param}" "0" "${cmd_bin}" 
	rc_print_status
}

status()
{
	pid=`rc_check_proc_cmd "${cmd_bin}"`
	
	if [ -n "${pid}" ];then
		rc_warning "service already started with pid "${pid}"."
	else
		rc_warning "service not started!"
	fi
}

restart()
{
	stop
	start
}

stop()
{
	rc_do_msg "Stopping telnetd "
	stop_daemon "${cmd_bin}"
	rc_print_status
}

#
# main
#

case "$1" in
	"start")
		start;;
	"status")
		status;;
	"stop")	
		stop;;
	"restart")
		restart;;
	*)
		echo "Usage: $0 start|stop|restart"
		exit 0
esac

